#!/bin/bash

#安装字体
installFonts() {
    sudo apt install ttf-mscorefonts-installer fontconfig xfonts-utils
    if [ ! -d /home/${user}/dev ]; then 
        mkdir -p /home/${user}/dev
    fi
    cd /home/${user}/dev
    if  ! command -v git > /dev/null; then
        . ${currentDir}/dev/installAndConfigGit.sh
    fi

    if [ ! -d /home/${user}/dev/${fonts_dir} ]; then
        git clone ${git_baseurl}${fonts_dir}".git"
    fi
    if [ ! -d /usr/share/fonts/myfonts ]; then
        sudo mkdir -p /usr/share/fonts/myfonts
    fi
    sudo cp /home/${user}/dev/${fonts_dir}/*.ttf /usr/share/fonts/myfonts
    cd /usr/share/fonts/myfonts
    sudo chmod 644 ./*
    sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
}

installFonts